package com.mac.test.springtest.controller;

import com.mac.test.springtest.mapper.UserMapper;
import com.mac.test.springtest.pojo.UserPojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class JDBCController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Autowired
    private UserMapper userMapper;

    @RequestMapping("getList")
    public List<Map<String, Object>> getList(){
        return jdbcTemplate.queryForList("select * from user");
    }

    @RequestMapping("getUserList")
    public List<UserPojo> getUserList(){
        return userMapper.getList();
    }
}
